<%@ page import="java.util.List" %>
<%@ page import="com.lu.entity.Topic" %>
<%@ page import="com.lu.dao.impl.TopicDaoImpl" %>
<%@ page import="com.lu.entity.NewsUsers" %>
<%@ include file="checkLogin.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%--
  Created by IntelliJ IDEA.
  User: l
  Date: 2022/5/26
  Time: 17:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!DOCTYPE>
<html>
<head>
    <title>管理后台</title>
    <link href="./css/admin.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="header">
    <div id="welcome">欢迎使用新闻管理系统！</div>
    <div id="nav">
        <div id="logo"><img src="./images/logo.jpg" alt="新闻中国"/></div>
        <div id="a_b01"><img src="./images/a_b01.gif" alt=""/></div>
    </div>
</div>
<div id="admin_bar">
    <div id="status">
        管理员：${currentUser.uname} 登录 &#160;&#160;&#160;&#160;
        <a href="logout.jsp">login out</a>
        当前在线的有${fn:length(currentUserList)} 个人:
        <c:forEach var="newsUsers" items="${currentUserList}">
            <a href="#">${newsUsers.uname}</a>
        </c:forEach>
    </div>
    <div id="channel"></div>
</div>
<div id="main">
    <div id="opt_list">
        <ul>
            <li><a href="news_add.jsp">添加新闻</a></li>
            <li><a href="#">编辑新闻</a></li>
            <li><a href="#">查找新闻</a></li>
            <li><a href="topic_add.jsp">添加主题</a></li>
            <li><a href="topicList.jsp">编辑主题</a></li>
            <li><a href="productList.jsp">购买商品</a></li>
            <li><a href="updateUser.jsp">修改个人资料</a></li>
        </ul>
    </div>
    <div id="opt_area">
        <script>
            function clickdel(tid) {
                if (confirm("确认要删除吗?")) {
                    location.href = "DeleteTopicServlet?tid=" + tid;
                }
            }
        </script>
        <ul>
            <%
                List<Topic> listTopic = new TopicDaoImpl().getAllTopic();
                request.setAttribute("lisTopic",listTopic);
            %>
            <c:forEach var="topic" items="${lisTopic}">
                <li>
                    <a href="#">${topic.tname}
                    </a>
                    <span style="float: right">
                <a href="#">修改</a>
                <a href="javascript:clickdel(${topic.tid})">删除</a>
                </span>
                </li>
            </c:forEach>
        </ul>
    </div>

</div>
<div id="site_link">
    <a href="">关于我们</a><span>|</span>
    <a href="">Aboue Us</a><span>|</span>
    <a href="">联系我们</a><span>|</span>
    <a href="">广告服务</a><span>|</span>
    <a href="">供稿服务</a><span>|</span>
    <a href="">法律声明</a><span>|</span>
    <a href="">招聘信息</a><span>|</span>
    <a href="">网站地图</a><span>|</span>
    <a href="">留言反馈</a>
</div>
</body>
</html>
